home *** CD-ROM | disk | FTP | other *** search
/ Day Cry / Day Cry CD.bin / oh_towns / taropyon / silib / silib.lzh / PRG / SDKFS / FSELEV.C < prev    next >
C/C++ Source or Header  |  1993-12-02  |  6KB  |  259 lines

  1. /*************************************************************************
  2. *    âCâxâôâg
  3. *************************************************************************/
  4.  
  5. #include    <stdio.h>
  6. #include    <stdlib.h>
  7.  
  8. #include    <silib.h>
  9. #include    <sipd.h>
  10. #include    <sicoltbl.h>
  11. #include    <sifs.h>
  12. #include    <EV/evque.h>
  13.  
  14. #include    "sdkfs.h"
  15. #include    "sdkfscf.h"
  16.  
  17. /*************************************************************************
  18. *    ÅIù╣âCâxâôâg
  19. *************************************************************************/
  20.  
  21. int        fsEvFunc_exit( int evNo, EVDAT_T *evdat )
  22. {
  23.     if ( EVCALL_CHKFUNC(evdat) <= EVCHK_NO )
  24.         return (EV_NOTHING);
  25.     return (FSEV_EXIT);
  26. }
  27.  
  28. /*************************************************************************
  29. *    âüâjâàü[âCâxâôâg
  30. *************************************************************************/
  31.  
  32. int        fsEvFunc_rightMenu( int evNo, EVDAT_T *evdat )
  33. {
  34.     FILESEL_T    *fs = evdat->ptr;
  35.  
  36.     if ( EVCALL_CHKFUNC(evdat) <= EVCHK_NO )
  37.         return (EV_NOTHING);
  38.     FileSel_menu( fs );
  39.     return (EV_NOTHING);
  40. }
  41.  
  42. /*************************************************************************
  43. *    âXâNâìü[âïâoü[âCâxâôâg
  44. *************************************************************************/
  45.  
  46. int        fsFunc_sbar( int evNo, SB_T *sb )
  47. {
  48.     FILESEL_T    *fs = sb->ptr;
  49.  
  50.     if ( fs->posDspTop == sb->top )
  51.         return (EV_NOTHING);
  52.     fs->posDspTop = sb->top;
  53.     FileSel_dspFndat( fs, -1 );
  54.     return (EV_NOTHING);
  55. }
  56.  
  57.  
  58. /*************************************************************************
  59. *    âhâëâCâuò╧ìXâCâxâôâg
  60. *************************************************************************/
  61.  
  62. int        fsEvFunc_chdrv( int drv, EVDAT_T *evdat )
  63. {
  64.     FILESEL_T    *fs = evdat->ptr;
  65.  
  66.     if ( EVCALL_CHKFUNC(evdat) <= EVCHK_NO )
  67.         return (EV_NOTHING);
  68.     fs->drv = drv;
  69.     return (FSEV_CHDRV);
  70. }
  71.  
  72. static int        fsEvChkFunc_file( EVDAT_T *evdat )
  73. {
  74.     struct _evfr_t    *para = evdat->para;
  75.  
  76.     if ( para == NULL || evdat->typ != EVTYP_FR )
  77.         return (EVCHK_ERR);    /* ERROR */
  78.  
  79.     {
  80.         FILESEL_T        *fs = evdat->ptr;
  81.         FNDAT_T            *fndat = fs->fnMat[evdat->evNo];
  82.         int                markMemo =  fndat->mark;
  83.         FRAME_T            *fr = &(para->fr);
  84.         POINT_T            point = {SiEv->pdX,SiEv->pdY};
  85.         int                mosx  = point.x;
  86.         int                mosy  = point.y;
  87.         int                evt   = 0;
  88.         clock_t            clk;
  89.  
  90.         if ( mosx < fr->x1 || mosx > fr->x2
  91.           || mosy < fr->y1 || mosy > fr->y2 )
  92.         {
  93.             return (EVCHK_NO);
  94.         }
  95.  
  96.         clk = SI_CLOCK(0) + 20;        /* â_âuâïâNâèâbâNè╘èu    */
  97.         EVQUE_NEXT(SiEv);
  98.  
  99.         evdat->stt |= EVDAT_STT_CHK;
  100.         fndat->mark = TRUE;    FileSel_dspFndat( fs, evdat->evNo );
  101.  
  102.         /* â{â^âôé≡ùúé╖é╠é≡îƒÅoé╖éΘ    */
  103.         for(;;)
  104.         {
  105.             EVQUE_T    *que;
  106.  
  107.             EV_sense(SiEv);
  108.             if ( (que = EVQUE_CHK(SiEv)) != NULL )
  109.             {
  110.                 if ( (que->typ & EVQUE_MOS_SWOFF) || (que->typ & EVQUE_MOS_MOVE) )
  111.                 {
  112.                     int        x, y;
  113.  
  114.                     x = que->ev.mos.point.x;
  115.                     y = que->ev.mos.point.y;
  116.                     if ( x < fr->x1 || x > fr->x2
  117.                       || y < fr->y1 || y > fr->y2 )
  118.                     {    /* ì└òWé¬èOéΩé╜    */
  119.                         evt = EVCHK_SCLC;
  120.                         break;
  121.                     }
  122.                     if ( (que->typ & EVQUE_MOS_SWOFF) )
  123.                     {    /* âNâèâbâNâ`âFâbâN */
  124.                         evt = EVCHK_SCLC;
  125.                         break;
  126.                     }
  127.                 }
  128.                 EVQUE_NEXT(SiEv);
  129.             }
  130.             if ( clk < SI_CLOCK(clk) )
  131.             {    /* âhâëâbâOâ^âCâv */
  132.                 evt = EVCHK_DRAG;
  133.                 break;
  134.             }
  135.         }
  136.  
  137.         if ( evt == EVCHK_SCLC )
  138.         {    /* â_âuâïâNâèâbâNîƒÅo    */
  139.  
  140.             clk = SI_CLOCK(0) + 20;        /* â_âuâïâNâèâbâNè╘èu    */
  141.             LOOP
  142.             {
  143.                 EVQUE_T    *que;
  144.  
  145.                 EV_sense(SiEv);
  146.                 if ( (que = EVQUE_CHK(SiEv)) != NULL )
  147.                 {
  148.                     if ( (que->typ & EVQUE_MOS_SWON) || (que->typ & EVQUE_MOS_MOVE) )
  149.                     {
  150.                         int        x, y;
  151.  
  152.                         x = que->ev.mos.point.x;
  153.                         y = que->ev.mos.point.y;
  154.                         if ( x < fr->x1 || x > fr->x2
  155.                           || y < fr->y1 || y > fr->y2 )
  156.                         {    /* ì└òWé¬èOéΩé╜    */
  157.                             evt = EVCHK_SCLC;
  158.                             break;
  159.                         }
  160.                         if ( (que->typ & EVQUE_MOS_SWON) )
  161.                         {
  162.                             evt = EVCHK_DCLC;    /* â_âuâïâNâèâbâN */
  163.                             break;
  164.                         }
  165.                     }
  166.                     EVQUE_NEXT(SiEv);
  167.                 }
  168.                 if ( clk < SI_CLOCK(clk) )
  169.                 {
  170.                     evt = EVCHK_SCLC;    /* âVâôâOâïâNâèâbâN */
  171.                     break;
  172.                 }
  173.             }
  174.         }
  175.         if ( evt == EVCHK_DCLC )
  176.             EV_waitMosSwOff();
  177.         fndat->mark = markMemo;        FileSel_dspFndat( fs, evdat->evNo );
  178.         evdat->stt &= (~ EVDAT_STT_CHK);
  179.         if ( evt )
  180.             return (evt);            /* âCâxâôâgÄ└ìs    */
  181.     }
  182.     return (EVCHK_NO);
  183. }
  184.  
  185. /*************************************************************************
  186. *    âtâ@âCâïæIæ≡âCâxâôâg
  187. *************************************************************************/
  188.  
  189. int        fsEvFunc_file( int pos, EVDAT_T *evdat )
  190. {
  191.     FILESEL_T        *fs = evdat->ptr;
  192.     FNDAT_T            *fndat = fs->fnMat[pos];
  193.     int                ret;
  194.  
  195.     if ( (ret = fsEvChkFunc_file(evdat)) <= EVCHK_NO )
  196.         return (EV_NOTHING);
  197.  
  198.     switch ( ret )
  199.     {
  200.         case EVCHK_SCLC:
  201.             if ( fndat->mark )
  202.             {    /* è∙é╔â}ü[âNé│éΩé─éóéΘ    */
  203.                 fndat->mark = FALSE;
  204.                 fs->buf[0] = '\0';
  205.             } else
  206.             {    if ( fs->posMark >= 0 )
  207.                 {    fs->fnMat[fs->posMark]->mark = FALSE;
  208.                     FileSel_dspFndat( fs, fs->posMark );
  209.                 }
  210.                 fndat->mark = TRUE;
  211.                 fs->posMark = pos;
  212.                 sprintf( fs->buf, "%s%s", fs->whare, fndat->buf.name );
  213.             }
  214.             FileSel_dspFndat( fs, pos );
  215.             FileSel_dspFnbuf( fs );
  216.             return (EV_NOTHING);
  217.  
  218.         case EVCHK_DCLC:
  219.             if ( !(fndat->mark) )
  220.             {
  221.                 if ( fs->posMark >= 0 )
  222.                 {    fs->fnMat[fs->posMark]->mark = FALSE;
  223.                     FileSel_dspFndat( fs, fs->posMark );
  224.                 }
  225.                 fndat->mark = TRUE;
  226.                 fs->posMark = pos;
  227.             }
  228.  
  229.             FileSel_dspFndat( fs, pos );
  230.             sprintf( fs->buf, "%s%s", fs->whare, fndat->buf.name );
  231.  
  232.             if ( fndat->buf.attrib & FSATT_DIR )
  233.             {    /* âfâBâîâNâgâè */
  234.                 FS_chdrv( fs->drv );
  235.                 FS_chdir( fs->buf );
  236.                 fs->buf[0] = '\0';
  237.                 ret = FSEV_CHDRV;
  238.             } else
  239.                 ret = FSEV_END;
  240.             FileSel_dspFnbuf( fs );
  241.             break;
  242.  
  243.         default:
  244.             ret = EV_NOTHING;
  245.     }
  246.     return (ret);
  247. }
  248.  
  249. /*************************************************************************
  250. *    Ä└ìsâLü[âCâxâôâg
  251. *************************************************************************/
  252.  
  253. int        fsEvFunc_exec( int evNo, EVDAT_T *evdat )
  254. {
  255.     if ( EVCALL_CHKFUNC(evdat) <= EVCHK_NO )
  256.         return (EV_NOTHING);
  257.     return (FSEV_END);
  258. }
  259.